package com.stop.controller;

import org.apache.http.client.CookieStore;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;

import android.os.StrictMode;

public class SessionController {
	
	private CookieStore cookieStore = new BasicCookieStore();
	private HttpContext localContext = new BasicHttpContext();

	private static SessionController instancia = null;
	
	private SessionController() {
		localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
		
		StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    	StrictMode.setThreadPolicy(policy);
	}
	
	public static HttpContext localContext(){
		if(instancia == null){
			instancia = new SessionController();
		}
		return instancia.localContext;
	}
	
}
